package com.work.service;
/**
 * @author： li
 * @date： 2021-05-28 09:18
 * @version 1.0
 */

import com.work.dao.emaildao;
import com.work.dao.userdao;
import com.work.pojo.email;
import com.work.pojo.user;
import com.work.util.PageUtil;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 * @author： Administrator
 * @date： 2021-05-28 09:18
 * @version 1.0
 */
public class userservice {
    //邮箱注册
public static int register(user user){
    int i=0;
    try {
        i= userdao.insert(user);
    } catch (SQLException | ClassNotFoundException e) {
        e.printStackTrace();
    }
    return i;
}
    //用户登入
    public static int login(user user) throws SQLException {
        ResultSet rs=null;
        try {
            rs= userdao.selectbyusernameandpassword(user);
        } catch (SQLException | ClassNotFoundException e) {
            e.printStackTrace();
        }
        if(rs.next()){
            return 1;
        }else {
            return 0;
        }
    }
    //用户修改
    public static  int update(user user){
        int i=0;
        try{
            i= userdao.update(user);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return i;

    }

}
